{extend name="public/basic"}
{block name="main"}
<h1 style = "margin-top:16px;">店铺认证信息</h1>
<hr />
{if condition="isset($store) and $store.valid eq 2"}
    <p class = "vm-3 b fs-1 danger">店铺审核不通过，原因：{$cert.audit_text|default=''}</p>
{else}
    {if condition="isset($store) and $store.valid eq 1"}
    <p class = "vm-3 b fs-1 ">实名认证已通过审核</p>
    {else /}
        {if condition="isset($store) and $store.valid eq 0"}
        <p class = "vm-3 b fs-1 warning ">店铺信息已提交，工作人员将在2-3个工作日审核...</p>
        {/if}
    {/if}
{/if}
<form class = "layui-form ajax _form" action="{:url('edit_store')}" method="post">
    <div class = "layui-form-item">
        <label class = "layui-form-label">门面照片</label>
        <div class = "layui-input-block">
            <input type="hidden" value="{$store.photo1|default=''}" name="photo1" id = "photo1"/>
            <img src = "{$store.photo1|default='/static/images/store1.jpg'}" class = "cert-image" id = "img-photo1"/>
        </div>
    </div>
    <div class = "layui-form-item">
        <label class = "layui-form-label">店铺照片1</label>
        <div class = "layui-input-block">
            <input type="hidden" value="{$store.photo2|default=''}" name="photo2" id = "photo2"/>
            <img src = "{$store.photo2|default='/static/images/store2.jpg'}" class = "cert-image" id = "img-photo2"/>
        </div>
    </div>
    <div class = "layui-form-item">
        <label class = "layui-form-label">店铺照片2</label>
        <div class = "layui-input-block">
            <input type="hidden" value="{$store.photo3|default=''}" name="photo3" id = "photo3"/>
            <img src = "{$store.photo3|default='/static/images/store3.jpg'}" class = "cert-image" id = "img-photo3"/>
        </div>
    </div>
    <div class = "layui-form-item">
        <button class = "layui-btn layui-btn-success fr">修改</button>
    </div>
</form>
{/block}
{block name="script"}
layui.use(["upload","layer","form"],function(){
    var upload = layui.upload;
    var layer = layui.layer;
    var form = layui.form;
    var cert1Inst = upload.render({
        elem:"#img-photo1",
        url:"{:url('home/file/upload')}",
        done: function(res) {
            $("#img-photo1").attr("src",res.msg);
            $("#photo1").val(res.msg);
        },
        error:function() {
            layer.msg('上传失败');
        }
    })
    var cert2Inst = upload.render({
        elem:"#img-photo2",
        url:"{:url('home/file/upload')}",
        done:function(res){
            $("#img-photo2").attr("src",res.msg);
            $("#photo2").val(res.msg);
        },
        error:function() {
            layer.msg("上传失败");
        }
    })
    var cert3Inst = upload.render({
        elem:"#img-photo3",
        url:"{:url('home/file/upload')}",
        done:function(res){
            $("#img-photo3").attr("src",res.msg);
            $("#photo3").val(res.msg);
        },
        error:function() {
            layer.msg("上传失败");
        }
    });
});
{/block}